﻿		<?php
				session_start();
				require_once('../config.php');
				include_once("../database/DataBase.php");
				include_once("function.php");

				$user_id = $_POST["user_id"];
				$pwd = $_POST["pwd"];
				$con_pwd = $_POST["con_pwd"];
				$email = $_POST["email"];
				$firstname = $_POST["firstname"];
				$lastname = $_POST["lastname"];
				$type = $_POST["type"];
				$contact_no = $_POST["contact_no"];
				$address = $_POST["address"];
				$birthday = $_POST["birthday"];
				$cid = $_POST["company_id"];
				$note = $_POST["note"];
								
				$database = New DataBase();
				$database->open_connection();
				$result = $database->editUser($user_id, $email, $firstname, $lastname, $type, $contact_no, $address, $birthday, $cid, $note);
				
				if(!is_null($result)){
					$database->LogAction($_SESSION["login_id"], "Edit", "Edit user ".$user_id." from ".getIpAddress());
					$_SESSION["message"] = "Update user (".$user_id.") success.";
					header('Location: ../Message.php');
				}
				
				$database->close_connection();
		?>